#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2018/1/21 0021 11:03
# @Author  : Arliki
# @File    : gui1.py

from tkinter import *
import tkinter.messagebox as mb


class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        self.createWidgets()

    def createWidgets(self):
        self.input_name = Entry(self)
        self.input_name.pack()
        self.btn_alert = Button(self, text='hello', command=self.hello)
        self.btn_alert.pack()
        self.btn_quit = Button(self, text='退出', command=self.quit)
        self.btn_quit.pack()

    def hello(self):
        name = self.input_name.get() or 'qianqian'
        mb.showinfo('New_Message', 'hello,%s' % name)


def run():
    app = Application()
    app.master.title('say hello')
    app.mainloop()


if __name__ == '__main__':
    run()
